#pragma once

#include "IScene.h"
#include <vector>

class TraceResult;

// Raw partition. 
// No special spatial acceleration structure is used. 
// All triangles are stored in a linear list, and each TraceRay function
// iterates all the triangles. 
// This should be a groundtruth implementation
class RawPartition: public IScenePartition
{
public: 
	RawPartition();
	virtual ~RawPartition();
	
	// return number of meshes in the scene
	virtual size_t ClearAllMeshes();
	virtual size_t AddMesh(const TCRTMesh* pMesh);
	virtual size_t GetNumberOfMeshes() const;
	virtual const TCRTMesh* GetMesh(size_t index) const;

	virtual bool BuildSpacePartition();

	virtual ITraceResult* TraceRay(const RAY* pRay, TraceType traceType);

protected: 
	void CleanMembers();

	std::vector<TCRTMesh*> mMeshes;
	TraceResult* mpResult;
};